import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import Log 1.0

CusWindowMask {
    id: root    

    Connections {
        target: helloManager
        function onTestSignals(data) {
            root.visible = true
            contentData.text = data
        }
    }

    Rectangle {
        id: winRect
        color: "green"
        radius: 20
        anchors.fill: parent
        ColumnLayout {
            anchors.fill: parent
            anchors.leftMargin: 20
            anchors.rightMargin: 20
            anchors.topMargin: 21
            anchors.bottomMargin: 20
            spacing: 0

            Text {
                id: infoText
                text: "这是helloword 模块的界面"
                font.pixelSize: 15
                horizontalAlignment: Text.AlignHCenter
                wrapMode: Text.WordWrap
                Layout.fillWidth: true
                Layout.leftMargin: 20
                Layout.rightMargin: 20
            }

            RowLayout {
                Layout.fillWidth: true
                Layout.topMargin: 10
                Layout.leftMargin: 10
                Layout.rightMargin: 10
                spacing: 10

                Text {
                    id: inputTitle
                    width: 120
                    text: "input data: "
                    font.pixelSize: 14
                }

                CusTextField {
                    id: content
                    Layout.fillWidth: true
                    implicitHeight: 28
                }

                CusSolidBtn {
                    id: subBtn
                    implicitWidth: 120
                    implicitHeight: 30
                    Layout.alignment: Qt.AlignHCenter
                    _text: "send"
                    onClicked: {
                        helloManager.doPostMessage(content.text)
                    }
                }
            }

            RowLayout {
                Layout.fillWidth: true
                Layout.topMargin: 10
                Text {
                    id: contentTitle
                    text: "Data from mainwindow: "
                    font.pixelSize: 14
                }

                Text {
                    id: contentData
                    text: ""
                    font.pixelSize: 14
                }

                Item {
                    Layout.fillWidth: true
                }
            }

            Item {
                Layout.fillHeight: true
            }

            RowLayout {
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignHCenter
                Layout.topMargin: 4
                CusSolidBtn {
                    id: okBtn
                    Layout.alignment: Qt.AlignCenter
                    implicitWidth: 96
                    implicitHeight: 30
                    _text: "关闭"
                    onClicked: {
                        root.close();
                    }
                }
            }
        }
    }
}
	
